package com.cn.demo6;

import java.net.URL;

public class Demo1 {

    public static void main(String[] args) {
        Class<Cat> catClass = Cat.class;
        //获取当前类所在包的目录
        URL resource = catClass.getResource("");
        System.out.println(resource.getPath());

        //获取当前类的根目录
        URL resource1 = catClass.getResource("/");
        String path = resource1.getPath();
        System.out.println(path);
    }
}
